# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: ponsfoot <cabezon dot hashimoto at gmail dot com>

pkgname=libkkc
pkgver=0.3.5
pkgrel=3
pkgdesc="Japanese Kana Kanji conversion library"
arch=('loong64' 'x86_64')
url="https://github.com/ueno/libkkc"
license=('GPL')
depends=('marisa' 'json-glib' 'libgee')
makedepends=('vala' 'gobject-introspection' 'intltool' 'python-marisa')
optdepends=('sh: to use kkc-package-data')
source=(https://github.com/ueno/libkkc/releases/download/v$pkgver/libkkc-$pkgver.tar.gz
        libkkc-python3.patch::https://github.com/ueno/libkkc/commit/ba1c1bd3eb86d887fc3689c3142732658071b5f7.patch)
sha512sums=('f611c3104a22ad38af29746870849d8937b6af2a7fee0952cc25f36ef845b5617a192df7ca63ff2a507384f7a6a13c9c1b4fa3b9a34f3f041bee8793d04b9236'
            'ba74aa8e545d32d40244f86009a49dedb575a6a8dd171baa5fc3e9a7aeac0ea51e4a7e2064a3f2b62f09bfa4751e3a33454a996b0acfe0fab45413dd84881755')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../libkkc-python3.patch
}

build() {
  cd $pkgname-$pkgver

  ./configure --prefix=/usr --disable-static --disable-silent-rules
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -Dm644 README data/rules/README.rules COPYING \
    -t "$pkgdir"/usr/share/doc/$pkgname-$pkgver/
}
